﻿// SettingDlg.cpp: 实现文件
//

#include "pch.h"
#include "ProjectAA.h"
#include "SettingDlg.h"
#include "afxdialogex.h"


// CSettingDlg 对话框

IMPLEMENT_DYNAMIC(CSettingDlg, CDialogEx)

CSettingDlg::CSettingDlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG_SETTING, pParent)
	, nPosX30(0)
	, nPosX31(0)
	, nPosX32(0)
	, nPosX33(0)
	, nPosY30(0)
	, nPosY31(0)
	, nPosY32(0)
	, nPosY33(0)
	, nPosZ30(0)
	, nPosZ31(0)
	, nPosZ32(0)
	, nPosZ33(0)
	, m_nPlasmaV(0)
	, m_dPlasmaR(0)
	, m_nGlueV(0)
	, m_dGlueR(0)
	, m_nPlasmaCircleNum(0)
	, m_nGlueCircleNum(0)
	, m_nGlueWait(0)
	, PassPlasma(FALSE)
	, OpenWeight(FALSE)
	, WeightDelay(0)
	, WeightDone(0)
	, WeightUp(0)
	, nPosX35(0)
	, nPosY35(0)
	, nPosZ35(0)
	, nPosX36(0)
	, nPosY36(0)
	, nPosZ36(0)
	, PinCheckFlag(FALSE)
	, PinCheckSpeed(0)
	, PinCheckDisX(0)
	, PinCheckPosY(0)
	, PinSetPosX(0)
	, PinSetPosY(0)
	, PinCheckPosZ(0)
	, PinSetPosZ(0)
	, m_nPlasmaWait(0)
	, PlasmaLifeSpec(0)
	, TanzhenLifeSpec(0)
	, CheckSNFlag(FALSE)
	, CheckSNLength(0)
	, m_nPowmax(0)
	, m_nPowmin(0)
	, PlasmaSizeup(FALSE)
	, m_nPlasmaWait_2(0)
	, GlueSNCheckFlag(FALSE)
	, GlueSNCheck(_T(""))
	, LgfSNCheck(_T(""))
{

}

CSettingDlg::~CSettingDlg()
{
}

void CSettingDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_POS_X16, nPosX30);
	DDX_Text(pDX, IDC_POS_X17, nPosX31);
	DDX_Text(pDX, IDC_POS_X18, nPosX32);
	DDX_Text(pDX, IDC_POS_X19, nPosX33);
	DDX_Text(pDX, IDC_POS_X20, nPosX34);
	DDX_Text(pDX, IDC_POS_Y16, nPosY30);
	DDX_Text(pDX, IDC_POS_Y17, nPosY31);
	DDX_Text(pDX, IDC_POS_Y18, nPosY32);
	DDX_Text(pDX, IDC_POS_Y19, nPosY33);
	DDX_Text(pDX, IDC_POS_Y20, nPosY34);
	DDX_Text(pDX, IDC_POS_Z16, nPosZ30);
	DDX_Text(pDX, IDC_POS_Z17, nPosZ31);
	DDX_Text(pDX, IDC_POS_Z18, nPosZ32);
	DDX_Text(pDX, IDC_POS_Z19, nPosZ33);
	DDX_Text(pDX, IDC_POS_Z20, nPosZ34);
	DDX_Text(pDX, IDC_EDIT10, m_nPlasmaV);
	DDX_Text(pDX, IDC_EDIT11, m_dPlasmaR);
	DDX_Text(pDX, IDC_EDIT12, m_nGlueV);
	DDX_Text(pDX, IDC_EDIT13, m_dGlueR);
	DDX_Text(pDX, IDC_EDIT14, m_nPlasmaCircleNum);
	DDX_Text(pDX, IDC_EDIT15, m_nGlueCircleNum);
	DDX_Text(pDX, IDC_EDIT16, m_nGlueWait);
	DDX_Check(pDX, IDC_CHECK1, PassPlasma);
	DDX_Check(pDX, IDC_CHECK3, OpenWeight);
	DDX_Text(pDX, IDC_EDIT1, WeightDelay);
	DDX_Text(pDX, IDC_EDIT2, WeightDone);
	DDX_Text(pDX, IDC_EDIT4, WeightUp);
	DDX_Text(pDX, IDC_POS_X21, nPosX35);
	DDX_Text(pDX, IDC_POS_Y21, nPosY35);
	DDX_Text(pDX, IDC_POS_Z21, nPosZ35);
	DDX_Control(pDX, IDC_COMBO1, m_comboSpeedMode);
	DDX_Text(pDX, IDC_POS_X22, nPosX36);
	DDX_Text(pDX, IDC_POS_Y22, nPosY36);
	DDX_Text(pDX, IDC_POS_Z22, nPosZ36);
	DDX_Check(pDX, IDC_CHECK5, PinCheckFlag);
	DDX_Text(pDX, IDC_EDIT24, PinCheckSpeed);
	DDX_Text(pDX, IDC_EDIT29, PinCheckDisX);
	DDX_Text(pDX, IDC_EDIT28, PinCheckPosY);
	DDX_Text(pDX, IDC_EDIT30, PinSetPosX);
	DDX_Text(pDX, IDC_EDIT31, PinSetPosY);
	DDX_Text(pDX, IDC_EDIT32, PinCheckPosZ);
	DDX_Text(pDX, IDC_EDIT33, PinSetPosZ);
	DDX_Text(pDX, IDC_EDIT34, m_nPlasmaWait);
	DDX_Text(pDX, IDC_EDIT35, PlasmaLifeSpec);
	DDX_Text(pDX, IDC_EDIT36, TanzhenLifeSpec);
	DDX_Check(pDX, IDC_CHECK6, CheckSNFlag);
	DDX_Text(pDX, IDC_EDIT37, CheckSNLength);
	DDX_Text(pDX, IDC_EDIT38, m_nPowmax);
	DDX_Text(pDX, IDC_EDIT39, m_nPowmin);
	DDX_Check(pDX, IDC_CHECK12, PlasmaSizeup);
	DDX_Text(pDX, IDC_EDIT40, m_nPlasmaWait_2);
	DDX_Check(pDX, IDC_CHECK10, GlueSNCheckFlag);
	DDX_Text(pDX, IDC_EDIT41, GlueSNCheck);
	DDX_Text(pDX, IDC_EDIT42, LgfSNCheck);
}


BEGIN_MESSAGE_MAP(CSettingDlg, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON_SAVE, &CSettingDlg::OnBnClickedButtonSave)
	ON_BN_CLICKED(IDC_BUTTON1, &CSettingDlg::OnBnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON2, &CSettingDlg::OnBnClickedButton2)
END_MESSAGE_MAP()


// CSettingDlg 消息处理程序


BOOL CSettingDlg::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	ReadConfigIni();
	m_comboSpeedMode.ResetContent();
	m_comboSpeedMode.AddString(L"0: 低速");
	m_comboSpeedMode.AddString(L"1: 高速");
	m_comboSpeedMode.SetCurSel(gSystemMgr.SpeedMode);

	//if (gSystemMgr.LoginFlag == 0) {
	//	CWnd *cSeBkBtnMy = GetDlgItem(IDC_BUTTON_SAVE);
	//	cSeBkBtnMy->EnableWindow(false);
	//}

	CWnd* ctrl = GetTopWindow();
	while (ctrl != NULL)
	{
		ctrl->EnableWindow(gSystemMgr.isAdmin ? TRUE : FALSE);
		ctrl = ctrl->GetNextWindow();
	}
	if (!gSystemMgr.isAdmin)
	{
		GetDlgItem(IDC_POS_X16)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_X17)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_X18)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_X19)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_X20)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_X21)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_X22)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Y16)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Y17)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Y18)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Y19)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Y20)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Y21)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Y22)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Z16)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Z17)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Z18)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Z19)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Z20)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Z21)->EnableWindow(TRUE);
		GetDlgItem(IDC_POS_Z22)->EnableWindow(TRUE);
		GetDlgItem(IDC_BUTTON_SAVE)->EnableWindow(TRUE);
	}

	return TRUE;
}


void CSettingDlg::OnCancel()
{
	// TODO: 在此添加专用代码和/或调用基类

	CDialogEx::OnCancel();
}

void CSettingDlg::ReadConfigIni()
{
	nPosX30 = gSystemMgr.m_nPosX3[0];
	nPosX31 = gSystemMgr.m_nPosX3[1];
	nPosX32 = gSystemMgr.m_nPosX3[2];
	nPosX33 = gSystemMgr.m_nPosX3[3];
	nPosX34 = gSystemMgr.m_nPosX3[4];
	nPosX35 = gSystemMgr.m_nPosX3[5];
	nPosX36 = gSystemMgr.m_nPosX3[6];
	nPosY30 = gSystemMgr.m_nPosY3[0];
	nPosY31 = gSystemMgr.m_nPosY3[1];
	nPosY32 = gSystemMgr.m_nPosY3[2];
	nPosY33 = gSystemMgr.m_nPosY3[3];
	nPosY34 = gSystemMgr.m_nPosY3[4];
	nPosY35 = gSystemMgr.m_nPosY3[5];
	nPosY36 = gSystemMgr.m_nPosY3[6];
	nPosZ30 = gSystemMgr.m_nPosZ3[0];
	nPosZ31 = gSystemMgr.m_nPosZ3[1];
	nPosZ32 = gSystemMgr.m_nPosZ3[2];
	nPosZ33 = gSystemMgr.m_nPosZ3[3];
	nPosZ34 = gSystemMgr.m_nPosZ3[4];
	nPosZ35 = gSystemMgr.m_nPosZ3[5];
	nPosZ36 = gSystemMgr.m_nPosZ3[6];

	m_nPlasmaV = gSystemMgr.m_nPlasmaV;
	m_dPlasmaR = gSystemMgr.m_dPlasmaR;
	m_nGlueV = gSystemMgr.m_nGlueV;
	m_dGlueR = gSystemMgr.m_dGlueR;

	m_nPlasmaCircleNum = gSystemMgr.m_nPlasmaCircleNum;
	m_nGlueCircleNum = gSystemMgr.m_nGlueCircleNum;

	m_nGlueWait = gSystemMgr.m_nGlueWait;
	m_nPlasmaWait = gSystemMgr.m_nPlasmaWait;
	m_nPlasmaWait_2 = gSystemMgr.m_nPlasmaWait_2;

	PassPlasma = gSystemMgr.PassPlasma;
	PlasmaSizeup= gSystemMgr.PlasmaSizeup;

	OpenWeight = gSystemMgr.OpenWeight;
	WeightDelay = gSystemMgr.WeightDelay;
	WeightDone = gSystemMgr.WeightDone;
	WeightUp = gSystemMgr.WeightUp;

	PinCheckFlag = gSystemMgr.PinCheckFlag;
	PinCheckSpeed = gSystemMgr.PinCheckSpeed;
	PinCheckDisX = gSystemMgr.PinCheckDis[0];
	PinCheckPosY = gSystemMgr.PinCheckDis[1];
	PinCheckPosZ = gSystemMgr.PinCheckDis[2];
	PinSetPosX = gSystemMgr.PinSetPosX;
	PinSetPosY = gSystemMgr.PinSetPosY;
	PinSetPosZ = gSystemMgr.PinSetPosZ;

	PlasmaLifeSpec = gSystemMgr.PlasmaLifeSpec;
	TanzhenLifeSpec = gSystemMgr.TanzhenLifeSpec;

	CheckSNFlag = gSystemMgr.CheckSNFlag;
	CheckSNLength = gSystemMgr.CheckSNLength;

	m_nPowmax = gSystemMgr.m_nPowmax;
	m_nPowmin = gSystemMgr.m_nPowmin;

	GlueSNCheckFlag = gSystemMgr.GlueSNCheckFlag;
	GlueSNCheck = gSystemMgr.GlueSNCheck;
	LgfSNCheck = gSystemMgr.LgfSNCheck;

	UpdateData(FALSE);
}

void CSettingDlg::SaveEditValueToConfig()
{
	UpdateData(TRUE);
	CString cstr;
	gSystemMgr.GlueSNCheckFlag = GlueSNCheckFlag;
	gSystemMgr.GlueSNCheck = GlueSNCheck;
	gSystemMgr.LgfSNCheck = LgfSNCheck;
	cstr.Format(L"%d", gSystemMgr.GlueSNCheckFlag); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"GlueSNCheckFlag", cstr);
	gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"GlueSNCheck", GlueSNCheck);
	gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"LgfSNCheck", LgfSNCheck);

	gSystemMgr.CheckSNFlag = CheckSNFlag;
	cstr.Format(L"%d", gSystemMgr.CheckSNFlag); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"CheckSNFlag", cstr);
	gSystemMgr.CheckSNLength = CheckSNLength;
	cstr.Format(L"%d", gSystemMgr.CheckSNLength); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"CheckSNLength", cstr);

	gSystemMgr.PlasmaLifeSpec = PlasmaLifeSpec;
	cstr.Format(L"%d", gSystemMgr.PlasmaLifeSpec); gSystemMgr.m_cGeneralSetting.SaveConfigIni(L"GeneralSetting", L"PlasmaLifeSpec", cstr);
	gSystemMgr.TanzhenLifeSpec = TanzhenLifeSpec;
	cstr.Format(L"%d", gSystemMgr.TanzhenLifeSpec); gSystemMgr.m_cGeneralSetting.SaveConfigIni(L"GeneralSetting", L"TanzhenLifeSpec", cstr);

	gSystemMgr.m_nPosX3[0] = nPosX30;
	gSystemMgr.m_nPosX3[1] = nPosX31;
	gSystemMgr.m_nPosX3[2] = nPosX32;
	gSystemMgr.m_nPosX3[3] = nPosX33;
	gSystemMgr.m_nPosX3[4] = nPosX34;
	gSystemMgr.m_nPosX3[5] = nPosX35;
	gSystemMgr.m_nPosX3[6] = nPosX36;
	gSystemMgr.m_nPosY3[0] = nPosY30;
	gSystemMgr.m_nPosY3[1] = nPosY31;
	gSystemMgr.m_nPosY3[2] = nPosY32;
	gSystemMgr.m_nPosY3[3] = nPosY33;
	gSystemMgr.m_nPosY3[4] = nPosY34;
	gSystemMgr.m_nPosY3[5] = nPosY35;
	gSystemMgr.m_nPosY3[6] = nPosY36;
	gSystemMgr.m_nPosZ3[0] = nPosZ30;
	gSystemMgr.m_nPosZ3[1] = nPosZ31;
	gSystemMgr.m_nPosZ3[2] = nPosZ32;
	gSystemMgr.m_nPosZ3[3] = nPosZ33;
	gSystemMgr.m_nPosZ3[4] = nPosZ34;
	gSystemMgr.m_nPosZ3[5] = nPosZ35;
	gSystemMgr.m_nPosZ3[6] = nPosZ36;

	gSystemMgr.m_nPlasmaV = m_nPlasmaV;
	gSystemMgr.m_dPlasmaR = m_dPlasmaR;
	gSystemMgr.m_nGlueV = m_nGlueV;
	gSystemMgr.m_dGlueR = m_dGlueR;

	gSystemMgr.m_nPlasmaCircleNum = m_nPlasmaCircleNum;
	gSystemMgr.m_nGlueCircleNum = m_nGlueCircleNum;
	gSystemMgr.m_nGlueWait = m_nGlueWait;
	gSystemMgr.m_nPlasmaWait = m_nPlasmaWait;
	gSystemMgr.m_nPlasmaWait_2 = m_nPlasmaWait_2;

	gSystemMgr.PassPlasma = PassPlasma;
	gSystemMgr.PlasmaSizeup = PlasmaSizeup;

	gSystemMgr.OpenWeight = OpenWeight;
	gSystemMgr.WeightDelay = WeightDelay;
	gSystemMgr.WeightDone = WeightDone;
	gSystemMgr.WeightUp = WeightUp;

	gSystemMgr.SpeedMode = m_comboSpeedMode.GetCurSel();

	gSystemMgr.PinCheckFlag = PinCheckFlag;
	gSystemMgr.PinCheckSpeed = PinCheckSpeed;
	gSystemMgr.PinCheckDis[0] = PinCheckDisX;
	gSystemMgr.PinCheckDis[1] = PinCheckPosY;
	gSystemMgr.PinCheckDis[2] = PinCheckPosZ;
	gSystemMgr.PinSetPosX = PinSetPosX;
	gSystemMgr.PinSetPosY = PinSetPosY;
	gSystemMgr.PinSetPosZ = PinSetPosZ;

	gSystemMgr.m_nPowmin = m_nPowmin;
	gSystemMgr.m_nPowmax = m_nPowmax;

	cstr.Format(L"%d", gSystemMgr.PinCheckFlag); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PinCheckFlag", cstr);
	cstr.Format(L"%d", gSystemMgr.PinCheckSpeed); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PinCheckSpeed", cstr);
	cstr.Format(L"%d", gSystemMgr.PinCheckDis[0]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PinCheckDis[0]", cstr);
	cstr.Format(L"%d", gSystemMgr.PinCheckDis[1]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PinCheckDis[1]", cstr);
	cstr.Format(L"%d", gSystemMgr.PinCheckDis[2]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PinCheckDis[2]", cstr);
	cstr.Format(L"%d", gSystemMgr.PinSetPosX); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PinSetPosX", cstr);
	cstr.Format(L"%d", gSystemMgr.PinSetPosY); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PinSetPosY", cstr);
	cstr.Format(L"%d", gSystemMgr.PinSetPosZ); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PinSetPosZ", cstr);

	cstr.Format(L"%d", gSystemMgr.m_nPosX3[0]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosX3[0]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosX3[1]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosX3[1]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosX3[2]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosX3[2]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosX3[3]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosX3[3]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosX3[4]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosX3[4]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosX3[5]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosX3[5]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosX3[6]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosX3[6]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosY3[0]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosY3[0]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosY3[1]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosY3[1]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosY3[2]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosY3[2]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosY3[3]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosY3[3]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosY3[4]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosY3[4]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosY3[5]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosY3[5]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosY3[6]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosY3[6]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosZ3[0]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosZ3[0]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosZ3[1]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosZ3[1]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosZ3[2]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosZ3[2]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosZ3[3]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosZ3[3]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosZ3[4]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosZ3[4]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosZ3[5]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosZ3[5]", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPosZ3[6]); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPosZ3[6]", cstr);

	cstr.Format(L"%d", gSystemMgr.m_nPlasmaV); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPlasmaV", cstr);
	cstr.Format(L"%.2f", gSystemMgr.m_dPlasmaR); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_dPlasmaR", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nGlueV); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nGlueV", cstr);
	cstr.Format(L"%.2f", gSystemMgr.m_dGlueR); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_dGlueR", cstr);

	cstr.Format(L"%d", gSystemMgr.m_nPlasmaCircleNum); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPlasmaCircleNum", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nGlueCircleNum); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nGlueCircleNum", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nGlueWait); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nGlueWait", cstr);
	cstr.Format(L"%d", gSystemMgr.PassPlasma); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PassPlasma", cstr);
	cstr.Format(L"%d", gSystemMgr.PlasmaSizeup); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"PlasmaSizeup", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPlasmaWait); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPlasmaWait", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPlasmaWait_2); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPlasmaWait_2", cstr);

	cstr.Format(L"%d", gSystemMgr.OpenWeight); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"OpenWeight", cstr);
	cstr.Format(L"%.2f", gSystemMgr.WeightDelay); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"WeightDelay", cstr);
	cstr.Format(L"%.2f", gSystemMgr.WeightDone); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"WeightDone", cstr);
	cstr.Format(L"%.2f", gSystemMgr.WeightUp); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"WeightUp", cstr);

	cstr.Format(L"%d", gSystemMgr.SpeedMode); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"SpeedMode", cstr);

	cstr.Format(L"%d", gSystemMgr.m_nPowmax); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPowmax", cstr);
	cstr.Format(L"%d", gSystemMgr.m_nPowmin); gSystemMgr.m_cPosConfigIni.SaveConfigIni(L"PosConfig", L"m_nPowmin", cstr);

	cstr.Format(L"修改保存配置:"); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PinCheckFlag:%d", gSystemMgr.PinCheckFlag); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PinCheckSpeed:%d", gSystemMgr.PinCheckSpeed); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PinCheckDis[0]:%d", gSystemMgr.PinCheckDis[0]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PinCheckDis[1]:%d", gSystemMgr.PinCheckDis[1]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PinCheckDis[2]:%d", gSystemMgr.PinCheckDis[2]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PinSetPosX:%d", gSystemMgr.PinSetPosX); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PinSetPosY:%d", gSystemMgr.PinSetPosY); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PinSetPosZ:%d", gSystemMgr.PinSetPosZ); gSystemLog.SaveLog(cstr.GetBuffer());

	cstr.Format(L"m_nPosX3[0]:%d", gSystemMgr.m_nPosX3[0]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosX3[1]:%d", gSystemMgr.m_nPosX3[1]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosX3[2]:%d", gSystemMgr.m_nPosX3[2]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosX3[3]:%d", gSystemMgr.m_nPosX3[3]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosX3[4]:%d", gSystemMgr.m_nPosX3[4]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosX3[5]:%d", gSystemMgr.m_nPosX3[5]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosX3[6]:%d", gSystemMgr.m_nPosX3[6]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosY3[0]:%d", gSystemMgr.m_nPosY3[0]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosY3[1]:%d", gSystemMgr.m_nPosY3[1]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosY3[2]:%d", gSystemMgr.m_nPosY3[2]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosY3[3]:%d", gSystemMgr.m_nPosY3[3]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosY3[4]:%d", gSystemMgr.m_nPosY3[4]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosY3[5]:%d", gSystemMgr.m_nPosY3[5]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosY3[6]:%d", gSystemMgr.m_nPosY3[6]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosZ3[0]:%d", gSystemMgr.m_nPosZ3[0]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosZ3[1]:%d", gSystemMgr.m_nPosZ3[1]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosZ3[2]:%d", gSystemMgr.m_nPosZ3[2]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosZ3[3]:%d", gSystemMgr.m_nPosZ3[3]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosZ3[4]:%d", gSystemMgr.m_nPosZ3[4]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosZ3[5]:%d", gSystemMgr.m_nPosZ3[5]); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPosZ3[6]:%d", gSystemMgr.m_nPosZ3[6]); gSystemLog.SaveLog(cstr.GetBuffer());

	cstr.Format(L"m_nPlasmaV:%d", gSystemMgr.m_nPlasmaV); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_dPlasmaR:%.2f", gSystemMgr.m_dPlasmaR); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nGlueV:%d", gSystemMgr.m_nGlueV); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_dGlueR:%.2f", gSystemMgr.m_dGlueR); gSystemLog.SaveLog(cstr.GetBuffer());

	cstr.Format(L"m_nPlasmaCircleNum:%d", gSystemMgr.m_nPlasmaCircleNum); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nGlueCircleNum:%d", gSystemMgr.m_nGlueCircleNum); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nGlueWait:%d", gSystemMgr.m_nGlueWait); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PassPlasma:%d", gSystemMgr.PassPlasma); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"PlasmaSizeup:%d", gSystemMgr.PlasmaSizeup); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPlasmaWait:%d", gSystemMgr.m_nPlasmaWait); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPlasmaWait_2:%d", gSystemMgr.m_nPlasmaWait_2); gSystemLog.SaveLog(cstr.GetBuffer());

	cstr.Format(L"OpenWeight:%d", gSystemMgr.OpenWeight); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"WeightDelay:%.2f", gSystemMgr.WeightDelay); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"WeightDone:%.2f", gSystemMgr.WeightDone); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"WeightUp:%.2f", gSystemMgr.WeightUp); gSystemLog.SaveLog(cstr.GetBuffer());

	cstr.Format(L"SpeedMode:%d", gSystemMgr.SpeedMode); gSystemLog.SaveLog(cstr.GetBuffer());

	cstr.Format(L"m_nPowmin:%d", gSystemMgr.m_nPowmin); gSystemLog.SaveLog(cstr.GetBuffer());
	cstr.Format(L"m_nPowmax:%d", gSystemMgr.m_nPowmax); gSystemLog.SaveLog(cstr.GetBuffer());
}

void CSettingDlg::OnBnClickedButtonSave()
{
	SaveEditValueToConfig();
}

void CSettingDlg::OnBnClickedButton1()
{
	if (IDYES == AfxMessageBox(L"确定 清零Plasma喷头使用次数 吗？", MB_YESNO | MB_ICONWARNING))
	{
		CString cstr;
		gSystemMgr.PlasmaLife = 0;
		cstr.Format(L"%d", gSystemMgr.PlasmaLife); gSystemMgr.m_cGeneralSetting.SaveConfigIni(L"GeneralSetting", L"PlasmaLife", cstr);
	}
}

void CSettingDlg::OnBnClickedButton2()
{
	if (IDYES == AfxMessageBox(L"确定 探针使用次数 吗？", MB_YESNO | MB_ICONWARNING))
	{
		CString cstr;
		gSystemMgr.TanzhenLife = 0;
		cstr.Format(L"%d", gSystemMgr.TanzhenLife); gSystemMgr.m_cGeneralSetting.SaveConfigIni(L"GeneralSetting", L"TanzhenLife", cstr);
	}
}
